
let token;
let userId;
$(document).ready(function() {
	var Request = new Object();
	Request = GetRequest();
	token = decodeURIComponent(Request["token"]); 
	userId = decodeURIComponent(Request["userId"]);
});
/* 设置 ajax 全局操作*/
$.ajaxSetup({
    beforeSend:function(){
		$(".confirmBtn").attr("disabled", "disabled");
    },
    complete:function(res){
		$(".confirmBtn").removeAttr("disabled");
    },
    error:function(response){
        var result = response.responseJSON;
    }
});
function ajax(url,data,type,successfn,msg){
	if(data == null){
		data = {}; 
	}
	var type = type||'post';
	if(type == 'post'){
		data = JSON.stringify(data);
		$.ajax({
			headers: {
				AppAuthorization:token,
				userId:userId
			},
			type:type,
			url:url,
			data:data,
			contentType: 'application/json',
			success:function(res){
				successfn(res)
			},error:function(){
				
			}
		});
	}else{
		data = data;
		$.ajax({
			headers: {
				AppAuthorization:token,
				userId:userId
			},
			type:type,
			url:url,
			data:data,
			contentType: 'application/json',
			success:function(res){
				successfn(res)
			},error:function(){
				
			}
		});
	}
}